public class Depot extends Board {
	private static final boolean[][] forbiddenPlaces = initForbidden();
	private static final int nForbidden = new Board(forbiddenPlaces).getSize();
	private static final int width = 4;
	private static final int height = 8;
	private int size;
	
	private static boolean[][] initForbidden() {
		boolean[][] res = new boolean[height][width];
		res[2][1] = true;
		res[5][2] = true;
		return res;
	}
	
	public Depot() {
		content = new boolean[8][4];
	}
	
	public int[] addPiece() {
		size++;
		for (int i = height - 1; i >= 0; i--) {
			for (int j = width - 1; j >= 0; j--) {
				if (!content[i][j] && !forbiddenPlaces[i][j]) {
					content[i][j] = true;
					return new int[] { j, i };
				}
			}
		}
		return null;
	}
	
	public int[] removePiece() {
		size--;
		for (int i = 0; i < height; i++) {
			for (int j = 0; j < width; j++) {
				if (content[i][j]) {
					content[i][j] = false;
					return new int[] { j, i };
				}
			}
		}
		return null;
	}
	
	public boolean isFull() {
		return size == height * width - nForbidden;
	}
}
